<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>确认报名-会员</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/xadmin.css">
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/Swiper/3.4.2/css/swiper.min.css">
    <script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/xadmin.js"></script>
</head>
<body>
<!-- 中部开始 -->
<div class="wrapper">
    <!-- 右侧主体开始 -->
    <div class="page-content">
        <div class="content">
            <!-- 右侧内容框架，更改从这里开始 -->
            <form class="layui-form" action="" method="">
                <input type="text" hidden name="applymem" value="${logUser.memid}" readonly>
                <input type="text" hidden name="applycourse" value="${applyCourse.courseid}" readonly>
                <div class="layui-form-item">
                    <label for="L1" class="layui-form-label">
                        报名课程
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L1" name="phone" required lay-verify="phone"
                               autocomplete="off" value="${applyCourse.coursename}" class="layui-input" readonly>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_2" class="layui-form-label">
                        报名费
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_2" name="phone" required lay-verify="phone"
                               autocomplete="off" value="${applyCourse.coursemoney}" class="layui-input" readonly>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_3" class="layui-form-label">
                        报名用户
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_3" name="phone" required lay-verify="phone"
                               autocomplete="off" value="${logUser.memrealname}" class="layui-input" readonly>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_phone" class="layui-form-label">
                        联系电话
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_phone" name="phone" required lay-verify="phone"
                               autocomplete="off" value="${logUser.memlogname}" class="layui-input" readonly>
                    </div>
                </div>
            </form><div class="layui-form-item">
            <label for="L_phone" class="layui-form-label">
            </label>
            <button class="layui-btn" key="set-mine" lay-filter="save" lay-submit id="save">
                确认报名
            </button>
            <button class="layui-btn" key="set-mine" lay-filter="save" onclick="x_admin_close()">
                返回
            </button>
        </div>
            <!-- 右侧内容框架，更改从这里结束 -->
        </div>
    </div>
    <!-- 右侧主体结束 -->
</div>
<!-- 中部结束 -->
<script>
    //确认报名信息
    $("#save").click(function (){
        $.ajax({
            url:"${pageContext.request.contextPath}/member/applyCourse.action",
            type:"post",
            data: {
                applymem:$("input[name='applymem']").val(),
                applycourse:$("input[name='applycourse']").val()
            },
            dataType:"text",
            success:function (date){
                if (date=="ok"){
                    //关闭报名页面弹框
                    layer.msg("报名成功！如有问题请及时联系管理员。");
                }else{
                    layer.msg("您已经报过名啦！");
                }
            },
            error:function (){
                console.log("确认报名信息出错");
            }
        });
    });
</script>
</body>
</html>
